package com.yytek.am.core.msg;

import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 告警源数据输入消息
 */
public class InputDataMessage {
    private static final Logger log = LoggerFactory.getLogger(InputDataMessage.class);

    public final InputData inputData;

    public InputDataMessage(InputData inputData) {
        this.inputData = inputData;
    }

    public static final class InputData extends JSONObject {
        private static final long serialVersionUID = 1L;

        public String getKpiName() {
            return this.getString("kpiName");
        }

        public String getKpiValue() {
            return this.getString("kpiValue");
        }

        public String getDeviceName() {
            return this.getString("deviceName");
        }

        public String getProductName() {
            return this.getString("productName");
        }

		public Boolean checkComplete() {
			if (this.getKpiName() != null && this.getKpiValue() != null
					&& this.getDeviceName() != null) {
				return true;
			}
            log.error("InputData is not complete! detailMessage:{}", this.toJSONString());
			return false;
		}

    }

}
